package org.jawa.learning.service.impl;

import java.util.List;

import org.jawa.core.exception.NotFoundException;
import org.jawa.learning.dao.MenuDao;
import org.jawa.learning.model.Menu;
import org.jawa.learning.service.MenuManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("menuManager")
public class MemuManagerImpl extends GenericManagerImpl<Menu, Long> implements MenuManager{
	
	private MenuDao menuDao;
	
	public MenuDao getMenuDao() {
		return menuDao;
	}

	@Autowired
	public void setMenuDao(MenuDao menuDao) {
		super.dao=menuDao;
		this.menuDao = menuDao;
	}

	public Menu getMenu(Long menuId) throws NotFoundException {
		return menuDao.getMenu(menuId);
	}

	public List<Menu> getTopMenus() {
		return menuDao.getTopMenus();
	}

	public List<Menu> getChildrenMenus(Long parentId) {
		return menuDao.getChildrenMenus(parentId);
	}

	@Override
	public List<Menu> getMenusByRole(Long roleId) {
		return menuDao.getMenusByRole(roleId);
	}

}
